<?php

namespace App\Http\Controllers;

use App\Library\Requests\Base\SerialNumberRequest;
use App\Library\Requests\Product\ProductAddRequest;
use App\Library\Requests\Product\ProductBuyWillListRequest;
use App\Library\Requests\Product\ProductBuyWillSpecsListRequest;
use App\Library\Requests\Product\ProductEditRequest;
use App\Library\Service\ProductService;
use Exception;
use Illuminate\Http\JsonResponse;

class ProductController extends BaseController
{
    /**
     * @param ProductService $service
     */
    public function __construct(ProductService $service)
    {
        $this->service = $service;
    }

    /**
     * add
     * @param PlugAddRequest $request
     * @return JsonResponse
     * @throws Exception
     */
    public function add(ProductAddRequest $request): JsonResponse
    {
        return $this->service->add($request);
    }

    /**
     * edit
     * @param ProductEditRequest $request
     * @return JsonResponse
     * @throws Exception
     */
    public function edit(ProductEditRequest $request): JsonResponse
    {
        return $this->service->edit($request);
    }

    /**
     * delete
     * @param SerialNumberRequest $request
     * @return JsonResponse
     * @throws Exception
     */
    public function delete(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->delete($request);
    }

    /**
     * copy
     * @param SerialNumberRequest $request
     * @return JsonResponse
     * @throws Exception
     */
    public function copy(SerialNumberRequest $request): JsonResponse
    {
        return $this->service->copy($request);
    }

    /**
     * adminTj
     * @return JsonResponse
     */
    public function adminTj(): JsonResponse
    {
        return $this->service->adminTj();
    }

    /**
     * buyWill
     * @param ProductBuyWillListRequest $request
     * @return JsonResponse
     */
    public function buyWillList(ProductBuyWillListRequest $request): JsonResponse
    {
        return $this->service->buyWillList($request);
    }

    /**
     *
     * @param ProductBuyWillSpecsListRequest $request
     * @return JsonResponse
     *
     */
    public function buyWillSpecsList(ProductBuyWillSpecsListRequest $request): JsonResponse
    {
        return $this->service->buyWillSpecsList($request);
    }
}
